<!DOCTYPE html>
<html lang="zh">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>学习助手</title>
    <link rel="stylesheet" type="text/css" href="./bootstrap/css/bootstrap.min.css">

    <link rel="stylesheet" type="text/css" href="./css/style.css">
    <link rel="icon" href="./img/logo.png" type="image/png">
</head>
<style>
    .title_label {
        left: 18px;
        top: 0px;
        height: 29px;
        color: rgba(255, 255, 255, 1);
        font-size: 20px;
        text-align: left;
        font-family: PingFangSC-bold;
    }

    .header_main {
        width: 100%;
        margin: auto;
        background-image: url(./img/head_bg.png);
        background-position: top -140px right 0px;
        height: auto;
        padding: 10px;
        background-size: cover;
        background-size: 100%;
        background-repeat: no-repeat;
        color: dimgray;

    }


    .menuStyle>li {
        float: left;
        margin-left: 10px;
        color: #0e5407;
        font-size: 16px;
        font-weight: 700;
    }

    .workStyle>li {
        float: left;
        margin-left: 10px;
        color: #fff;
        font-weight: 700;
    }

   
</style>

<body id="mainAPP" class="header_main">
    <header id="home">

        <ul class="workStyle">
            <li>
                <!-- 今日，参数是当前时间往后退1天，所以参数天1 -->
                <button class="btn btn-success" onclick="window.location.href='/home.html'">个人信息 </button>

            </li>
            <li>
                <!-- 今日，参数是当前时间往后退1天，所以参数天1 -->
                <button class="btn btn-warning" onclick="window.location.href='/records.html'">加分记录 </button>

            </li>
            <li>
                <!-- 7天，参数是当前时间往后退7天，所以参数填7 -->
                <button class="btn btn-secondary" onclick="window.location.href='/fill.html'">填写加分 </button>
            </li>
        </ul>

    </header>
    <!-- 为 图表设置的 DOM -->
    <!-- 列出所选日期内有工作量的设备 -->

 
    <div style="position: fixed; bottom: 50px; width: 90%;">
         <textarea name="" id="liaotianInput" style="width: 100%;" rows="3"></textarea>
    <button onclick="sendMessage()">发送消息</button>

    </div> 
    <div id="msgList">
        
    </div>

   
    <div style="position:absolute; bottom: 0px;left: 0; width: 100%;   background-color: #17ad74; " id="bottomBox">
        <div style="color: white; text-align: center;" id="userinfo">信息工程学院</div>
    </div>
    <script type="text/javascript" src="./js/md5.js"></script>
    <script src="./bootstrap/js/bootstrap.min.js"></script>


    <script>

        
 
        // 创建 WebSocket 对象，连接到Go语言服务器的WebSocket端点
        const socket = new WebSocket('ws://localhost:8080/v3/classmates/getChouJiangRenList');
        // 当WebSocket连接成功建立时触发的事件
        socket.onopen = function () {
            console.log('WebSocket连接已建立');
        };

        // 当接收到来自服务器的消息时触发的事件
        socket.onmessage = function (event) {
            document.getElementById("msgList").innerHTML += event.data +"<br>"
            document.getElementById("liaotianInput").value = "";
        }; 

        function sendMessage() {
            let msg = document.getElementById("liaotianInput").value;
            socket.send(msg);
          
        }
    </script>


</body>

</html>